package com.sskj.wallet.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.wallet.bean.CoinListBean;
import com.sskj.wallet.bean.RechargeBean;
import com.sskj.wallet.ui.activity.RechargeActivity;

import java.util.List;


/**
 * @author Hey
 * Create at  2019/06/26
 */
public class RechargePresenter extends BasePresenter<RechargeActivity> {

    public void getCoinLists(int type) {
        httpService.getCoinLists(type)
                .tag(this)
                .execute(new JsonCallBack<HttpData<List<CoinListBean>>>() {
                    @Override
                    public void onSuccess(Response<HttpData<List<CoinListBean>>> response) {
                        mView.getCoinListOK(response.body().getData());
                    }
                });
    }

    public void getRechargeData(String coin) {
        httpService.getRechargeData(coin)
                .tag(this)
                .execute(new JsonCallBack<HttpData<RechargeBean>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<RechargeBean>> response) {
                        mView.getRechargeDataOK(response.body().getData());
                    }
                });
    }
}
